package by.exposit.dao;

import by.exposit.dao.entity.UserEntity;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by HaRiA on 30.07.2014.
 */
         @Repository
         @Transactional
public class UserDAOImpl extends GenericDAOImpl <UserEntity,Long>   implements  UserDAO
{


    @Override
    public UserEntity getUserByLoginPassword(String login, String password) {
        Criteria cr = getSession()
                .createCriteria(UserEntity.class, "users")
                .add(Restrictions.eq("login", login))
                .add(Restrictions.eq("password", password));

        return (UserEntity) cr.uniqueResult();



    }


}
